#! python
# -*- coding: UTF-8 -*-
"""
@Project ：zhzg-v2 
@File    ：sms_sample_conf.py
@IDE     ：PyCharm 
@Author  ：zhangyiheng
@Date    ：2025/1/15 16:23 
@Describe：百度 SmsClient
"""
import logging

from baidubce.auth.bce_credentials import BceCredentials
# 从Python SDK导入SMS配置管理模块以及安全认证模块
from baidubce.bce_client_configuration import BceClientConfiguration
from baidubce.services.sms.sms_client import SmsClient

#设置SmsClient的Host，Access Key ID和Secret Access Key
HOST = "smsv3.bj.baidubce.com"
AK = "ade3d4bb9c5243acbb019afbf47dca8d"
SK = "4c5a0ffbd43e4b8ab48d4aceaa763c3f"

#设置日志文件的句柄和日志级别
logger = logging.getLogger('baidubce.http.bce_http_client')
fh = logging.FileHandler("sample.log")
fh.setLevel(logging.DEBUG)

#设置日志文件输出的顺序、结构和内容
formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
fh.setFormatter(formatter)
logger.setLevel(logging.DEBUG)
logger.addHandler(fh)

#创建BceClientConfiguration
config = BceClientConfiguration(credentials=BceCredentials(AK, SK), endpoint=HOST)

zhzgv2_sms_client = SmsClient(config)

# 签名id
SIGNATURE_ID = "sms-sign-zleEik70019"